Translating Refinitiv Excel Formula to Eikon Python API
I have an excel plugin formula which I want to convert to Python Code and get the same result via eikon Python API.
My excel formula is : =@RHistory("DEBMK2;DEBMM2;DEBMN2;DEBQN2;DEBQV2;DEBQF3;DEBYF3;DEBYF4;DEBYF5;DEBYF6;DEBYF7;DEBYF8;DEBYF9;DEBYF0",".Timestamp;.Close","NBROWS:365 INTERVAL:1D",,"TSREPEAT:NO CH:IN;Fd",B27)
I used ek.get_timeseries method but it is showing error for few tickers in the list. I was told I can get the same output using ek.get_data method. But I unable to find the correct params for this.
I tried the following code but it is not working for me:
df, err = ek.get_data(['DEBMc1', 'DEBMc2', 'DEBMc3', 'DEBQc1', 'DEBQc2', 'DEBQc3', 'DEBYc1', 'DEBYc2' , 'DEBYc3' , 'DEBYc4' , 'DEBYc5' , 'DEBYc6' , 'DEBYc7' , 'DEBYc8' ],
['TR.Timestamp','TR.Close'], {'SDate' : startDate, 'EDate': reportDate})
Where startDate and reportDate are defined elsewhere.
Can someone explain me how to find relevant fields to be provided here?
Best Answer
-
Hi @Mohit.Rai
Using the refinitiv-data library, you can try this:
import refinitiv.data as rd
from refinitiv.data.content import historical_pricing
# Within CodeBook, this will automatically use the Desktop Session
rd.open_session()
...
items = ['DEBMc1','DEBMc2','DEBMc3','DEBQc1','DEBQc2','DEBQc3',
'DEBYc1','DEBYc2','DEBYc3','DEBYc4','DEBYc5','DEBYc6',
'DEBYc7','DEBYc8']
response = historical_pricing.summaries.Definition(
universe = items,
start='2021-05-01',
end='2022-06-08',
fields=['SETTLE']
).get_data()
response.data.dfThe 'SETTLE' field is defined as the official closing price. In addition, there are no duplicates in this data set. As suggested, I would follow up with the helpdesk to confirm the content.
1
Answers
-
You can try ['TR.ClosePrice.Date','TR.ClosePrice'] fields.
df, err = ek.get_data(['DEBMc1','DEBMc2','DEBMc3','DEBQc1','DEBQc2','DEBQc3','DEBYc1','DEBYc2','DEBYc3','DEBYc4','DEBYc5','DEBYc6','DEBYc7','DEBYc8' ],
['TR.ClosePrice.Date','TR.ClosePrice'], {'SDate' : '2021-05-01', 'EDate': '2022-06-08', 'FRQ':'D'})However, I found duplicated entries.
The =TR function in Eikon Excel also returns the same duplicated entries. The get_data method can be used to retrieve the same content as the =TR function in Eikon Excel. Therefore, you need to contact the Eikon Excel support team directly via MyRefinitiv to verify the content. You may ask for the =TR formula in Eikon Excel which can be used to get the required data. Then, you can apply it to the get_data method.
0
Categories
- All Categories
- 6 AHS
- 39 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 367 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 59 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛